/**
 * 
 */
package com.alstudio.module.xmpp.protocol.xmpp.util.xmlcreator;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author alonso lee
 * 
 */
public class AlXmlTag {

	// 用于表示该节点的属性值
	private Map<String, String> atts = new LinkedHashMap<String, String>();
	// 用于表示该节点的text
	private String text;
	// 用于表示节点名
	private String tagName;
	
	//节点下是否还有子节点
	private boolean hasSubTag = false;

	public AlXmlTag(String tagName) {
		// TODO Auto-generated constructor stub
		setTagName(tagName);
	}

	/**
	 * 设置属性包
	 * 
	 * @param atts
	 */
	public void setAtts(HashMap<String, String> atts) {
		this.atts = atts;
	}

	/**
	 * 获取属性包
	 * 
	 * @return
	 */
	public Map<String, String> getAtts() {
		return atts;
	}

	/**
	 * 设置属性
	 * 
	 * @param key
	 * @param value
	 */
	public void setAtt(String key, String value) {
		atts.put(key, value);
	}

	/**
	 * 获取属性
	 * 
	 * @param key
	 * @return
	 */
	public String getAtt(String key) {
		return atts.get(key);
	}

	/*
	 * 获取该节点text
	 */
	public String getText() {
		return text;
	}

	/**
	 * 设置该节点text
	 * 
	 * @param text
	 */
	public void setText(String text) {
		this.text = text;
	}

	/**
	 * 获取该节点名
	 * 
	 * @return
	 */
	public String getTagName() {
		return tagName;
	}

	/**
	 * 设置该节点名
	 * 
	 * @param tagName
	 */
	public void setTagName(String tagName) {
		this.tagName = tagName;
	}
	
	/**
	 * @return the hasSubTag
	 */
	public boolean isHasSubTag() {
		return hasSubTag;
	}
	
	/**
	 * @param hasSubTag the hasSubTag to set
	 */
	public void setHasSubTag(boolean hasSubTag) {
		this.hasSubTag = hasSubTag;
	}

	public void release() {
		if (atts != null) {
			atts.clear();
			atts = null;
		}
	}

}